Binary translation is a high performance emulator that allows an application, compiled for one instruction set architecture (referred to herein as a “source ISA”) to run on a different ISA (referred to herein as a “target ISA”). Essentially, binary translation (BT) is a general technique to translate binaries built for one source ISA to another target ISA. Accordingly, by using binary translation, it is possible to execute application binaries built for one processor ISA on a processor with a different architecture, without recompiling high-level source code or rewriting assembly code. Since many legacy computer applications are available in binary formats, binary translation is very attractive due to its potential to allow a processor to execute applications that are not built and available for it.
Generally, binary translation systems follow the same basic execution flow. First, a binary file created for the source architecture is loaded into memory. Sections of this source binary are then translated into target binary code. This translation is typically done “on-demand”. In other words, the source-code instructions are translated as the flow of control reaches them. Typically, the translation is performed at the granularity of basic blocks, which are sequences of instructions with a single entry and potentially multiple exits. Once a basic block is translated, the translation is kept in a translation cache (also referred to herein as “code cache”) in memory for future reuse.